package com.tengju.bff.interfaces.covercharge.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * @author liang_shi
 * @date 2020/7/16 10:21
 * @description 合同签署状态
 */
@Getter
@AllArgsConstructor
public enum ContractStatusEnum {

    /**
     * 签署中
     */
    PROCESSING("1", "签署中,未完成"),

    SUCCESS("2", "合同签署完成"),

    LOCK_FAILED("3", "锁定合同失败"),

    CANCEL("4", "签署合同取消,未完成"),

    SIGN_EXPIRE("5", "合同签署过期"),

    EXPIRE("6", "合同过期"),

    UNKNOWN("9", "未知状态"),
    ;

    private String status;

    private String msg;


    public static ContractStatusEnum getInstance(String status) {
        if (StringUtils.isBlank(status)) {
            return null;
        }
        for (ContractStatusEnum statusEnum : ContractStatusEnum.values()) {
            if (statusEnum.getStatus().equals(status)) {
                return statusEnum;
            }
        }
        return null;
    }

}
